﻿using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Xml;

namespace T.FAS.Runtime.DataAccess.SQLDom
{
    /// <summary>
    /// Insert插入语句类
    /// </summary>
    /// <remarks>Insert插入语句</remarks>
    public class InsertSqlStaORA : InsertSqlStatement
    {
        #region 构造函数

        public InsertSqlStaORA()
            : base()
        {
        }

        #endregion

        #region 方法

        /// <summary>
        /// 克隆
        /// </summary>
        /// <returns>Insert插入语句</returns>
        public override object Clone()
        {
            var sql = base.Clone() as InsertSqlStaORA;
            if (InsertFields != null)
                sql.InsertFields = InsertFields.Clone() as InsertFieldList;
            if (InsertValues != null)
                sql.InsertValues = InsertValues.Clone() as InsertValueList;

            return sql;
        }

        /// <summary>
        /// 转换成SQL
        /// </summary>
        /// <returns>SQL</returns>
        public override string ToSQL()
        {
            string insertSQL = string.Empty;
           
            if (string.IsNullOrWhiteSpace(insertSQL))
            {
                insertSQL = string.Format("INSERT INTO {0} {1}", this.TableName, InsertFields.ToSQL().Replace("\"", ""));               
            }

            return insertSQL;
        }
        #endregion
    }
}
